package com.huang.dao;

import com.huang.pojo.User;
import com.huang.util.MybatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class UserDaotext {
    @Test
    public void text() {
        //第一步获取SqlSession对象
        SqlSession sqlSession = MybatisUtils.getSqlSession();
        //方法一
        //第二步执行SQL语句
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        List<User> userList = mapper.getUserList();
        //方法二
        //淘汰了//List<User> userList=sqlSession.selectList("com.huang.dao.UserDao.getUserList");
        for (User user : userList) {
            System.out.println(user);
        }
        sqlSession.close();
    }
}
